﻿using System;
using System.Collections.Generic;
using System.Web;
using GateKeeper;
using BlogEngine;

namespace GateKeeper
{
    public class GateKeeperHook : IHttpModule
    {
        public void Dispose()
        { }

        public void Init(HttpApplication application)
        {
            application.BeginRequest += new EventHandler(begin_request);
        }

        private void begin_request(object sender, EventArgs e)
        {
            GateKeeperModule.config.SmtpEmailAddress = BlogEngine.Core.BlogSettings.Instance.Email;
            GateKeeperModule.config.SmtpServerName = BlogEngine.Core.BlogSettings.Instance.SmtpServer;
            GateKeeperModule.config.SmtpEnableSSL = BlogEngine.Core.BlogSettings.Instance.EnableSsl;
            GateKeeperModule.config.SmtpServerPort = BlogEngine.Core.BlogSettings.Instance.SmtpServerPort;
            GateKeeperModule.config.SmtpUserName = BlogEngine.Core.BlogSettings.Instance.SmtpUserName;
            GateKeeperModule.config.SmtpPassword = BlogEngine.Core.BlogSettings.Instance.SmtpPassword;
            GateKeeperModule.config.StorePasswordEncrypted = false;
        }

    }

}